interface obj {
    name:'string'
}
interface obj {
    num:number
}
interface obj {
    title:'你好新世界'
}
interface obj {
    desc:'very good'
}
// interface生命同名会自动合并

let newObj:obj = {
    name:'string',
    num:18,
    title:'你好新世界',
    desc:'very good'
}


// type 声明同名会报错
// type newType = {
//     name:'123'
// }
// type newType = {
//     num:123
// }

// 文字推理
function request(url :string, method: 'GET' | 'POST' | 'PUT') {

}
const req = {
    url:'http://www.baidu.com',
    method:'GET' as 'GET'
}
request(req.url, req.method)
request(req.url, req.method as 'GET')

// 将对象转为文字类型
const req1 = {
    url: "https://blog.csdn.net/m0_51969330?type=blog",
    method: "GET",
} as const;

request(req1.url, req1.method)
